package com.lagou.controller;

import com.lagou.annotation.AutoWried;
import com.lagou.annotation.Controller;
import com.lagou.annotation.RequestMapping;
import com.lagou.annotation.Security;
import com.lagou.service.SpringService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * desc:
 *
 * @author tengfei wang
 * @version 1.0
 * @date Created in 13/9/2020
 */
@Security({"lisi"})
@Controller
@RequestMapping("/spring")
public class SpringController {

    @AutoWried
    public SpringService springService;

    @RequestMapping("/handler1")
    public void handler1(HttpServletRequest request, HttpServletResponse response, String username) throws IOException {
        springService.test(username);
        response.getWriter().println(username);
    }

    @RequestMapping("/handler2")
    public void handler2(HttpServletResponse response) throws IOException {
        response.getWriter().println("this is handler2");
    }

    @Security({"zhangsan"})
    @RequestMapping("/handler3")
    public void handler3(HttpServletResponse response) throws IOException {
        response.getWriter().println("this is handler3");
    }
}
